package com.lb.action;

import java.util.Map;

import com.lb.bean.User;
import com.lb.service.UserService;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;


public class ReviseUserAction extends ActionSupport {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private User user;
	private UserService service;
	
	public User getUser() {
		return user;
	}



	public void setUser(User user) {
		this.user = user;
	}



	public UserService getService() {
		return service;
	}



	public void setService(UserService service) {
		this.service = service;
	}



	@SuppressWarnings("unchecked")
	public String execute() throws Exception
	{
		ActionContext.getContext().getSession().clear();
		 Map session=ActionContext.getContext().getSession();
		User user1=this.service.findUserByAccountName(user.getAccountName());
		user1.setEmail(user.getEmail());
		user1.setName(user.getName());
		user1.setSex(user.getSex());
		user1.setAddress(user.getAddress());
		user1.setTelephone(user.getTelephone());
		this.service.update(user1);
		session.put("user",user1);
		return SUCCESS;
	}


}
